<?php
/**
 * Created by PhpStorm.
 * User: fuguang
 * Date: 2017/6/20
 * Time: 下午12:09
 */
use yii\helpers\Html;
use yii\grid\GridView;
use common\models\User;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use kartik\select2\Select2Asset;
use kartik\select2\Select2;

Select2Asset::register($this);
?>
<div id="selectuser" style="height: 400px;">

<?php $form = ActiveForm::begin(['id' => 'form-signup','enableAjaxValidation' => false,]); ?>

<?= $form->field($model, 'userid')->label("Select User")->widget(
    Select2::classname(), [
    'data' => ArrayHelper::map(User::find()->where(['status'=>10])->all(),'id','username'),
    'theme' => Select2::THEME_BOOTSTRAP,
    'language' => 'en',
    'options' => ['multiple' => true,'placeholder' => 'Select a user ...'],
    'pluginOptions' => [
        'allowClear' => true
    ],
]);
?>
<?php ActiveForm::end(); ?>

</div>
